\(\int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx\) [325]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [B] (verified)
   Fricas [F]
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 23, antiderivative size = 246 \[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\frac {\sqrt {a+b} \cot (c+d x) \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right ) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (1+\sec (c+d x))}{a-b}}}{d}-\frac {\cot (c+d x) \sqrt {a+b \sec (c+d x)}}{d}+\frac {2 \cot (c+d x) \operatorname {EllipticPi}\left (\frac {a}{a+b},\arcsin \left (\frac {\sqrt {a+b}}{\sqrt {a+b \sec (c+d x)}}\right ),\frac {a-b}{a+b}\right ) \sqrt {-\frac {b (1-\sec (c+d x))}{a+b \sec (c+d x)}} \sqrt {\frac {b (1+\sec (c+d x))}{a+b \sec (c+d x)}} (a+b \sec (c+d x))}{\sqrt {a+b} d} \]

[Out]

cot(d*x+c)*EllipticF((a+b*sec(d*x+c))^(1/2)/(a+b)^(1/2),((a+b)/(a-b))^(1/2))*(a+b)^(1/2)*(b*(1-sec(d*x+c))/(a+
b))^(1/2)*(-b*(1+sec(d*x+c))/(a-b))^(1/2)/d+2*cot(d*x+c)*EllipticPi((a+b)^(1/2)/(a+b*sec(d*x+c))^(1/2),a/(a+b)
,((a-b)/(a+b))^(1/2))*(a+b*sec(d*x+c))*(-b*(1-sec(d*x+c))/(a+b*sec(d*x+c)))^(1/2)*(b*(1+sec(d*x+c))/(a+b*sec(d
*x+c)))^(1/2)/d/(a+b)^(1/2)-cot(d*x+c)*(a+b*sec(d*x+c))^(1/2)/d

Rubi [A] (verified)

Time = 0.27 (sec) , antiderivative size = 246, normalized size of antiderivative = 1.00, number of steps used = 5, number of rules used = 4, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {3981, 3865, 3960, 3917} \[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\frac {\sqrt {a+b} \cot (c+d x) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (\sec (c+d x)+1)}{a-b}} \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right )}{d}+\frac {2 \cot (c+d x) \sqrt {-\frac {b (1-\sec (c+d x))}{a+b \sec (c+d x)}} \sqrt {\frac {b (\sec (c+d x)+1)}{a+b \sec (c+d x)}} (a+b \sec (c+d x)) \operatorname {EllipticPi}\left (\frac {a}{a+b},\arcsin \left (\frac {\sqrt {a+b}}{\sqrt {a+b \sec (c+d x)}}\right ),\frac {a-b}{a+b}\right )}{d \sqrt {a+b}}-\frac {\cot (c+d x) \sqrt {a+b \sec (c+d x)}}{d} \]

[In]

Int[Cot[c + d*x]^2*Sqrt[a + b*Sec[c + d*x]],x]

[Out]

(Sqrt[a + b]*Cot[c + d*x]*EllipticF[ArcSin[Sqrt[a + b*Sec[c + d*x]]/Sqrt[a + b]], (a + b)/(a - b)]*Sqrt[(b*(1
- Sec[c + d*x]))/(a + b)]*Sqrt[-((b*(1 + Sec[c + d*x]))/(a - b))])/d - (Cot[c + d*x]*Sqrt[a + b*Sec[c + d*x]])
/d + (2*Cot[c + d*x]*EllipticPi[a/(a + b), ArcSin[Sqrt[a + b]/Sqrt[a + b*Sec[c + d*x]]], (a - b)/(a + b)]*Sqrt
[-((b*(1 - Sec[c + d*x]))/(a + b*Sec[c + d*x]))]*Sqrt[(b*(1 + Sec[c + d*x]))/(a + b*Sec[c + d*x])]*(a + b*Sec[
c + d*x]))/(Sqrt[a + b]*d)

Rule 3865

Int[Sqrt[csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Simp[2*((a + b*Csc[c + d*x])/(d*Rt[a + b, 2]*Cot[
c + d*x]))*Sqrt[b*((1 + Csc[c + d*x])/(a + b*Csc[c + d*x]))]*Sqrt[(-b)*((1 - Csc[c + d*x])/(a + b*Csc[c + d*x]
))]*EllipticPi[a/(a + b), ArcSin[Rt[a + b, 2]/Sqrt[a + b*Csc[c + d*x]]], (a - b)/(a + b)], x] /; FreeQ[{a, b,
c, d}, x] && NeQ[a^2 - b^2, 0]

Rule 3917

Int[csc[(e_.) + (f_.)*(x_)]/Sqrt[csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)], x_Symbol] :> Simp[-2*(Rt[a + b, 2]/(b*
f*Cot[e + f*x]))*Sqrt[(b*(1 - Csc[e + f*x]))/(a + b)]*Sqrt[(-b)*((1 + Csc[e + f*x])/(a - b))]*EllipticF[ArcSin
[Sqrt[a + b*Csc[e + f*x]]/Rt[a + b, 2]], (a + b)/(a - b)], x] /; FreeQ[{a, b, e, f}, x] && NeQ[a^2 - b^2, 0]

Rule 3960

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))^(m_)/cos[(e_.) + (f_.)*(x_)]^2, x_Symbol] :> Simp[Tan[e + f*x]*((a
+ b*Csc[e + f*x])^m/f), x] + Dist[b*m, Int[Csc[e + f*x]*(a + b*Csc[e + f*x])^(m - 1), x], x] /; FreeQ[{a, b, e
, f, m}, x]

Rule 3981

Int[cot[(c_.) + (d_.)*(x_)]^(m_)*(csc[(c_.) + (d_.)*(x_)]*(b_.) + (a_))^(n_), x_Symbol] :> Int[ExpandIntegrand
[(a + b*Csc[c + d*x])^n, (-1 + Sec[c + d*x]^2)^(-m/2), x], x] /; FreeQ[{a, b, c, d, n}, x] && NeQ[a^2 - b^2, 0
] && ILtQ[m/2, 0] && IntegerQ[n - 1/2] && EqQ[m, -2]

Rubi steps \begin{align*} \text {integral}& = \int \left (-\sqrt {a+b \sec (c+d x)}+\csc ^2(c+d x) \sqrt {a+b \sec (c+d x)}\right ) \, dx \\ & = -\int \sqrt {a+b \sec (c+d x)} \, dx+\int \csc ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx \\ & = -\frac {\cot (c+d x) \sqrt {a+b \sec (c+d x)}}{d}+\frac {2 \cot (c+d x) \operatorname {EllipticPi}\left (\frac {a}{a+b},\arcsin \left (\frac {\sqrt {a+b}}{\sqrt {a+b \sec (c+d x)}}\right ),\frac {a-b}{a+b}\right ) \sqrt {-\frac {b (1-\sec (c+d x))}{a+b \sec (c+d x)}} \sqrt {\frac {b (1+\sec (c+d x))}{a+b \sec (c+d x)}} (a+b \sec (c+d x))}{\sqrt {a+b} d}+\frac {1}{2} b \int \frac {\sec (c+d x)}{\sqrt {a+b \sec (c+d x)}} \, dx \\ & = \frac {\sqrt {a+b} \cot (c+d x) \operatorname {EllipticF}\left (\arcsin \left (\frac {\sqrt {a+b \sec (c+d x)}}{\sqrt {a+b}}\right ),\frac {a+b}{a-b}\right ) \sqrt {\frac {b (1-\sec (c+d x))}{a+b}} \sqrt {-\frac {b (1+\sec (c+d x))}{a-b}}}{d}-\frac {\cot (c+d x) \sqrt {a+b \sec (c+d x)}}{d}+\frac {2 \cot (c+d x) \operatorname {EllipticPi}\left (\frac {a}{a+b},\arcsin \left (\frac {\sqrt {a+b}}{\sqrt {a+b \sec (c+d x)}}\right ),\frac {a-b}{a+b}\right ) \sqrt {-\frac {b (1-\sec (c+d x))}{a+b \sec (c+d x)}} \sqrt {\frac {b (1+\sec (c+d x))}{a+b \sec (c+d x)}} (a+b \sec (c+d x))}{\sqrt {a+b} d} \\ \end{align*}

Mathematica [A] (verified)

Time = 3.61 (sec) , antiderivative size = 154, normalized size of antiderivative = 0.63 \[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\frac {\sqrt {a+b \sec (c+d x)} \left (-\cot (c+d x)-\frac {2 \cos ^2\left (\frac {1}{2} (c+d x)\right ) \left ((-2 a+b) \operatorname {EllipticF}\left (\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right )+4 a \operatorname {EllipticPi}\left (-1,\arcsin \left (\tan \left (\frac {1}{2} (c+d x)\right )\right ),\frac {a-b}{a+b}\right )\right ) \sqrt {\frac {1}{1+\sec (c+d x)}} \sqrt {\frac {a+b \sec (c+d x)}{(a+b) (1+\sec (c+d x))}}}{b+a \cos (c+d x)}\right )}{d} \]

[In]

Integrate[Cot[c + d*x]^2*Sqrt[a + b*Sec[c + d*x]],x]

[Out]

(Sqrt[a + b*Sec[c + d*x]]*(-Cot[c + d*x] - (2*Cos[(c + d*x)/2]^2*((-2*a + b)*EllipticF[ArcSin[Tan[(c + d*x)/2]
], (a - b)/(a + b)] + 4*a*EllipticPi[-1, ArcSin[Tan[(c + d*x)/2]], (a - b)/(a + b)])*Sqrt[(1 + Sec[c + d*x])^(
-1)]*Sqrt[(a + b*Sec[c + d*x])/((a + b)*(1 + Sec[c + d*x]))])/(b + a*Cos[c + d*x])))/d

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(545\) vs. \(2(226)=452\).

Time = 5.81 (sec) , antiderivative size = 546, normalized size of antiderivative = 2.22

method result size
default \(\frac {\sqrt {a +b \sec \left (d x +c \right )}\, \left (4 \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticPi}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), -1, \sqrt {\frac {a -b}{a +b}}\right ) \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, a \cos \left (d x +c \right )-2 \operatorname {EllipticF}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), \sqrt {\frac {a -b}{a +b}}\right ) \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, a \cos \left (d x +c \right )+\operatorname {EllipticF}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), \sqrt {\frac {a -b}{a +b}}\right ) \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, b \cos \left (d x +c \right )+4 \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, \operatorname {EllipticPi}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), -1, \sqrt {\frac {a -b}{a +b}}\right ) a -2 \operatorname {EllipticF}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), \sqrt {\frac {a -b}{a +b}}\right ) \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, a +\operatorname {EllipticF}\left (\cot \left (d x +c \right )-\csc \left (d x +c \right ), \sqrt {\frac {a -b}{a +b}}\right ) \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {b +a \cos \left (d x +c \right )}{\left (a +b \right ) \left (\cos \left (d x +c \right )+1\right )}}\, b -a \cos \left (d x +c \right ) \cot \left (d x +c \right )-\cot \left (d x +c \right ) b \right )}{d \left (b +a \cos \left (d x +c \right )\right )}\) \(546\)

[In]

int(cot(d*x+c)^2*(a+b*sec(d*x+c))^(1/2),x,method=_RETURNVERBOSE)

[Out]

1/d*(a+b*sec(d*x+c))^(1/2)/(b+a*cos(d*x+c))*(4*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticPi(cot(d*x+c)-csc(d*x
+c),-1,((a-b)/(a+b))^(1/2))*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*a*cos(d*x+c)-2*EllipticF(cot(d*x+c
)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^
(1/2)*a*cos(d*x+c)+EllipticF(cot(d*x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(
a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*b*cos(d*x+c)+4*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos
(d*x+c))/(cos(d*x+c)+1))^(1/2)*EllipticPi(cot(d*x+c)-csc(d*x+c),-1,((a-b)/(a+b))^(1/2))*a-2*EllipticF(cot(d*x+
c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*cos(d*x+c))/(cos(d*x+c)+1))
^(1/2)*a+EllipticF(cot(d*x+c)-csc(d*x+c),((a-b)/(a+b))^(1/2))*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*(1/(a+b)*(b+a*
cos(d*x+c))/(cos(d*x+c)+1))^(1/2)*b-a*cos(d*x+c)*cot(d*x+c)-cot(d*x+c)*b)

Fricas [F]

\[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\int { \sqrt {b \sec \left (d x + c\right ) + a} \cot \left (d x + c\right )^{2} \,d x } \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^(1/2),x, algorithm="fricas")

[Out]

integral(sqrt(b*sec(d*x + c) + a)*cot(d*x + c)^2, x)

Sympy [F]

\[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\int \sqrt {a + b \sec {\left (c + d x \right )}} \cot ^{2}{\left (c + d x \right )}\, dx \]

[In]

integrate(cot(d*x+c)**2*(a+b*sec(d*x+c))**(1/2),x)

[Out]

Integral(sqrt(a + b*sec(c + d*x))*cot(c + d*x)**2, x)

Maxima [F]

\[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\int { \sqrt {b \sec \left (d x + c\right ) + a} \cot \left (d x + c\right )^{2} \,d x } \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^(1/2),x, algorithm="maxima")

[Out]

integrate(sqrt(b*sec(d*x + c) + a)*cot(d*x + c)^2, x)

Giac [F]

\[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\int { \sqrt {b \sec \left (d x + c\right ) + a} \cot \left (d x + c\right )^{2} \,d x } \]

[In]

integrate(cot(d*x+c)^2*(a+b*sec(d*x+c))^(1/2),x, algorithm="giac")

[Out]

integrate(sqrt(b*sec(d*x + c) + a)*cot(d*x + c)^2, x)

Mupad [F(-1)]

Timed out. \[ \int \cot ^2(c+d x) \sqrt {a+b \sec (c+d x)} \, dx=\int {\mathrm {cot}\left (c+d\,x\right )}^2\,\sqrt {a+\frac {b}{\cos \left (c+d\,x\right )}} \,d x \]

[In]

int(cot(c + d*x)^2*(a + b/cos(c + d*x))^(1/2),x)

[Out]

int(cot(c + d*x)^2*(a + b/cos(c + d*x))^(1/2), x)